class Solution:
    def twoSum(self, nums, target):
        n = len(nums)
        for i in range(0, n):
            for j in range(i + 1, n):
                if nums[i] + nums[j] == target:
                    return [i, j]

    def twoSum2(self, nums, target):
        hashmap = {}
        for ind, num in enumerate(nums):
            print(ind, num)
            hashmap[num] = ind
            print("hashmap[num]:", hashmap[num])
        print(hashmap)
        for i, num in enumerate(nums):
            j = hashmap.get(target - num)
            print(j)
            if j is not None and i != j:
                return [i, j]


if __name__ == '__main__':
    a = Solution()
    print(a.twoSum2([2, 7, 11, 15], 9))
